<?php $this->load->view('admin/public/head.html', array('js' => array(
'/assets/library/ckplayer/ckplayer.js'
), 'css' => array(
'/assets/admin/css/admin/common.css'
))); ?>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper goodsAdmin" ng-controller="admin-goods-add-controller">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            商品管理
            <small>添加商品信息</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="/home/index"><i class="fa fa-dashboard"></i> 后台首页</a></li>
            <li><a href="/goods/lists/index"><i class="fa fa-dashboard"></i> 商品管理</a></li>
            <li class="active">添加商品</li>
        </ol>
    </section>

    <!-- Main content -->
    <section class="content gu-goods">
        <div class="row adminBase">
            <div class="col-md-12">
                <div class="box box-info">
                    <div class="box-header with-border">
                        <h3 class="box-title">添加商品</h3>
                    </div>
                    <!-- form start -->
                    <form class="form-horizontal">
                        <div class="box-body">
                            <div class="form-group">
                                <label for="baseName" class="col-sm-2 control-label">商品名称<span class="text-red">*</span></label>
                                <div class="col-sm-6">
                                    <input type="text" class="form-control" ng-model="detail.goodsName" id="baseName" placeholder="商品名称">
                                    <p class="help-block">商品名称必须填写, 请小于 <span class="text-red">120</span> 个汉字</p>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="baseName" class="col-sm-2 control-label">商品描述</label>
                                <div class="col-sm-6">
                                    <textarea class="form-control" style="height: 90px;" placeholder="商品描述信息" ng-model="detail.description"></textarea>
                                    <p class="help-block">商品描述选择填写, 请小于 <span class="text-red">250</span> 个汉字</p>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">商品分类<span class="text-red">*</span></label>
                                <div class="col-sm-3">
                                    <select class="form-control" ng-model="detail.categoryId" ng-options="c.id as c.name group by getLabel(c.parentId) for c in catsOpt">
                                        <option value="">请选择......</option>
                                    </select>
                                </div>
                                <div class="col-sm-3 col-sm-offset-1">
                                    <p class="help-block">没有分类? 立即<a href="/goods/category/index">添加</a></p>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">选择基地<span class="text-red">*</span></label>
                                <div class="col-sm-4">
                                    <select class="form-control" ng-model="detail.baseId" ng-options="b.id as b.name for b in bases">
                                        <option value="">请选择......</option>
                                    </select>
                                </div>
                                <div class="col-sm-3">
                                    <p class="help-block">没有找到? 立即<a href="/farm/base/add">添加</a></p>
                                </div>
                            </div>
                            <!--
                            <div class="form-group">
                                <label class="col-sm-2 control-label">顶部Banner图<span class="text-red">*</span></label>
                                <div class="col-sm-6">
                                    <div class="thumb-base-box">
                                        <img ng-show="bannerThumbView" ng-src="{{ bannerThumbView }}" alt="">
                                    </div>
                                    <button class="btn btn-info" id="uploadBannerImage">选择图片</button>
                                    <p class="help-block">用于显示在详情页顶部Bannder处,长宽比例 16:9 &nbsp;&nbsp;建议尺寸 640 * 360</p>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">推荐缩略图<span class="text-red">*</span></label>
                                <div class="col-sm-6">
                                    <div class="thumb-base-box recommend-thumb">
                                        <img ng-show="recommendThumbView" ng-src="{{ recommendThumbView }}" alt="">
                                    </div>
                                    <button class="btn btn-info" id="uploadRecommendImage">选择图片</button>
                                    <p class="help-block">用于显示在相关产品推荐页面,如基地详情页,长宽比例2:3 &nbsp;&nbsp;建议尺寸 200 * 300</p>
                                </div>
                            </div>
                            -->
                            <div class="form-group">
                                <label class="col-sm-2 control-label">缩略图<span class="text-red">*</span></label>
                                <div class="col-sm-6">
                                    <div class="thumb-base-box waterflow-thumb">
                                        <img ng-show="thumbView" ng-src="{{ thumbView }}" alt="">
                                    </div>
                                    <button class="btn btn-info" id="uploadImage">选择图片</button>
                                    <p class="help-block">任意大小,用户瀑布流等显示相关位置显示</p>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">商品图<span class="text-red">*</span></label>
                                <div class="col-sm-6">
                                    <div class="gu-thumbs">
                                        <div class="gu-thumb-add-btn-1" ng-show="thumbLists.length == 0">
                                            <div class="gu-thumb-icon"><i class="fa fa-image"></i></div>
                                            <div class="btn btn-success gu-thumb-icon-btn" id="addGoodsPic1">选择图片</div>
                                        </div>
                                        <div class="gu-thumb-add-btn-2" ng-show="thumbLists.length > 0">
                                            <div class="gu-thumb-box">
                                                <div ng-repeat="(index, t) in thumbLists" class="gu-thumb-lists">
                                                    <span class="gu-thumb-list-del" ng-click="removeThumb(index)"><i class="fa fa-remove"></i></span>
                                                    <img ng-src="{{ t.thumb }}" alt="">
                                                </div>
                                            </div>
                                            <div class="btn btn-success pull-right" id="addGoodsPic2" style="margin-left: 10px;">继续添加</div>
                                            <div class="btn btn-default pull-right" ng-click="clearAll()">清空所有</div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="h5-share" class="col-sm-2 control-label">H5视频地址</label>
                                <div class="col-sm-6">
                                    <input type="text" class="form-control" ng-model="detail.liveUrl" id="h5-share" placeholder="视频 H5 页面播放地址">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">计量单位</label>
                                <div class="col-sm-2">
                                    <select class="form-control" ng-model="detail.unit">
                                        <option ng-repeat="u in units" ng-bind="u.name" value="{{ u.name }}"></option>
                                    </select>
                                </div>
                                <div class="col-sm-4">
                                    <p class="help-block" style="margin-top: 12px;">找不到? 立即<a href="/goods/category/index">设置</a></p>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">商品规格</label>
                                <div class="col-sm-6">
                                    <table class="table table-bordered">
                                        <tr>
                                            <th class="text-center">规格名称</th>
                                            <th class="text-center">库存</th>
                                            <th class="text-center">原价</th>
                                            <th class="text-center">现价</th>
                                            <th class="text-center">商品重量</th>
                                            <th class="text-center">物流计重</th>
                                            <th class="text-center">操作</th>
                                        </tr>
                                        <tr ng-show="rules.length > 0" ng-repeat="(index, r) in rules">
                                            <td class="text-center" ng-bind="r.ruleName"></td>
                                            <td class="text-center" ng-bind="r.ruleStore"></td>
                                            <td class="text-center" ng-bind="r.ruleOldPrice"></td>
                                            <td class="text-center" ng-bind="r.ruleNewPrice"></td>
                                            <td class="text-center" ng-bind="r.ruleGoodsWeight"></td>
                                            <td class="text-center" ng-bind="r.ruleExpressWeight"></td>
                                            <td class="text-center">
                                                <a href="javascript:void(0);" ng-click="removeRuleItem(index)" class="btn btn-link btn-xs">删除</a>
                                            </td>
                                        </tr>
                                        <tr ng-if="rules.length == 0">
                                            <td colspan="7" class="text-center" style="color: #aaaaaa;">暂未设置,请 <a href="javascript:void(0);" ng-click="addRule()">添加</a></td>
                                        </tr>
                                    </table>
                                    <p ng-show="rules.length > 0" class="help-block">还不够? <a href="javascript:void(0);" ng-click="addRule()">继续添加</a></p>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">运费设置</label>
                                <div class="col-sm-6">
                                    <table class="table">
                                        <tr>
                                            <td style="width: 100px; cursor: pointer;" ng-click="expType(1)">
                                                <i class="fa" ng-class="{'fa-dot-circle-o': selectExpType == 1, 'text-green': selectExpType == 1, 'fa-circle-o': selectExpType == 2}"></i> &nbsp;
                                                运费模板
                                            </td>
                                            <td style="width: 160px;">
                                                <div class="btn-group" style="width: 150px;">
                                                    <button type="button" class="btn btn-default btn-flat" ng-bind="'默认模板'"></button>
                                                    <button type="button" class="btn btn-default btn-flat dropdown-toggle" data-toggle="dropdown">
                                                        <span class="caret"></span>
                                                        <span class="sr-only">Toggle Dropdown</span>
                                                    </button>
                                                    <ul class="dropdown-menu" role="menu">
                                                        <li><a ng-click="selectRole(key)" ng-bind="'默认模板'"></a></li>
                                                    </ul>
                                                </div>
                                            </td>
                                            <td>
                                                按商品物流重量进行计价
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="cursor: pointer; border-bottom: 1px solid #f4f4f4;" ng-click="expType(2)">
                                                <i class="fa" ng-class="{'fa-dot-circle-o': selectExpType == 2, 'text-green': selectExpType == 2, 'fa-circle-o': selectExpType == 1}"></i> &nbsp;
                                                统一邮费
                                            </td>
                                            <td style="border-bottom: 1px solid #f4f4f4;">
                                                <div class="input-group margin" style="width: 107px; margin: 0;">
                                                    <input type="text" ng-model="detail.expAmount" class="form-control" placeholder="0.00">
                                                    <span class="input-group-btn">
                                                        <button type="button" class="btn btn-default btn-flat">元</button>
                                                    </span>
                                                </div>
                                            </td>
                                            <td style="border-bottom: 1px solid #f4f4f4;">
                                                商品邮费一口价
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">热度</label>
                                <div class="col-sm-5">
                                    <div class="stars">
                                        <i ng-repeat="($index, s) in stars" ng-class="{'fa-star': s <= detail.stars, 'fa-star-o': s > detail.stars, 'text-red': s <= detail.stars}" class="fa star-icon" ng-click="setStar(s)"></i>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">商品介绍<span class="text-red">*</span></label>
                                <div class="col-sm-8">
                                    <script id="container" name="content" type="text/plain"></script>
                                </div>
                            </div>
                        </div>
                        <!-- /.box-body -->
                        <div class="box-footer">
                            <button type="submit" class="btn btn-default" onclick="history.go(-1)">返回列表</button>
                            <button type="submit" class="btn btn-info pull-right" ng-click="save()">确定添加</button>
                        </div>
                        <!-- /.box-footer -->
                    </form>
                </div>
            </div>
        </div>
    </section>
    <!-- /.content -->

    <div class="modal" id="videoModal">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title">商品规格</h4>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal">
                        <div class="box-body">
                            <div class="form-group">
                                <label for="ruleName" class="col-sm-2 control-label">规格名称<span class="text-red">*</span></label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" id="ruleName" ng-model="ruleItem.ruleName" placeholder="规格名称">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">库存<span class="text-red">*</span></label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" ng-model="ruleItem.ruleStore" placeholder="商品库存数">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">原价<span class="text-red">*</span></label>
                                <div class="col-sm-8">
                                    <div class="input-group">
                                        <span class="input-group-addon"><i class="fa fa-cny"></i></span>
                                        <input type="text" class="form-control" ng-model="ruleItem.ruleOldPrice" placeholder="0.00">
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">现价<span class="text-red">*</span></label>
                                <div class="col-sm-8">
                                    <div class="input-group">
                                        <span class="input-group-addon"><i class="fa fa-cny"></i></span>
                                        <input type="text" class="form-control" ng-model="ruleItem.ruleNewPrice" placeholder="0.00">
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="expressWeight" class="col-sm-2 control-label">商品重量<span class="text-red">*</span></label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" id="goodsWeight" ng-model="ruleItem.ruleGoodsWeight" placeholder="物流重量（千克）">
                                    <p class="help-block">单个商品净重</p>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="expressWeight" class="col-sm-2 control-label">物流计重<span class="text-red">*</span></label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" id="expressWeight" ng-model="ruleItem.ruleExpressWeight" placeholder="物流重量（千克）">
                                    <p class="help-block">物流重量, 会根据物流模板计价, 不计价请设置0</p>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default pull-left" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary" ng-click="addRuleItem()">保存</button>
                </div>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div>
</div>
<!-- /.content-wrapper -->
<?php $this->load->view('admin/public/foot.html', array('js' => array(
'http://cdn.staticfile.org/webuploader/0.1.0/webuploader.withoutimage.min.js',
'/assets/library/ueditor/ueditor.config.js',
'/assets/library/ueditor/ueditor.all.min.js',
'/assets/admin/js/goods/add.js'
))); ?>

